package com.bac.rentmap.web.controller.osmimport;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import com.bac.rentmap.manager.BuildingManager;

/**
 *
 * @author Ivan Holub
 */
public class AjaxClearBuildingsController extends AbstractController {

    private BuildingManager buildingManager;

    public void setBuildingManager(BuildingManager buildingManager) {
        this.buildingManager = buildingManager;
    }

    protected ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
        int maxNumber = buildingManager.getMaxNumber(httpServletRequest.getParameter("city"));
        ModelAndView mav = new ModelAndView("admin/import/osm/ajaxclearbuildings");
        mav.addObject("maxNumber", maxNumber);
        return mav;
    }
}